package com.df.tv.launcher.exception;

import com.df.tv.launcher.LauncherApplication;
import com.df.tv.launcher.R;

public class FileAccessException extends TVException {
    private static final long serialVersionUID = 1L;
    /** 文件读取错误 */
    public static final int FILE_IO_EXCEPTION = 101;
    /** 文件不存在 */
    public static final int FILE_NOT_FOUND = 102;
    /** 未发现外存储设备 */
    public static final int EXTERNAL_STORAGE_DEVICE_NOT_FOUND = 103;

    public FileAccessException(int code) {
        super(code);
    }

    public FileAccessException(int code, String msg) {
        super(code, msg);
    }

    @Override
    protected String getMsgByCode(int code) {
        switch (code) {
        case FILE_IO_EXCEPTION:
            return LauncherApplication.getInstance().getString(R.string.file_io_exception);
        case FILE_NOT_FOUND:
            return LauncherApplication.getInstance().getString(R.string.file_not_found);
        case EXTERNAL_STORAGE_DEVICE_NOT_FOUND:
            return LauncherApplication.getInstance().getString(R.string.external_storage_device_not_found);
        }
        return LauncherApplication.getInstance().getString(R.string.unknow_file_exception);
    }

}